<html>
<head><meta charset="utf-8"><title>Integrating other programs  into the output · t-compiler/rust-analyzer · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/index.html">t-compiler/rust-analyzer</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Integrating.20other.20programs.20.20into.20the.20output.html">Integrating other programs  into the output</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="205904166"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Integrating%20other%20programs%20%20into%20the%20output/near/205904166" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Integrating.20other.20programs.20.20into.20the.20output.html#205904166">(Aug 04 2020 at 13:13)</a>:</h4>
<p>If I had some super-cool program that searched through Rust code and returned matching locations, would there be some way of integrating it with r-a so that editors could benefit? Does LSP have a concept of  multiple concurrent backends for one editor?</p>



<a name="205904995"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Integrating%20other%20programs%20%20into%20the%20output/near/205904995" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Integrating.20other.20programs.20.20into.20the.20output.html#205904995">(Aug 04 2020 at 13:20)</a>:</h4>
<p>If this is a completely separate problem, it probably makes sense to implement a separate LSP server</p>



<a name="205905027"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Integrating%20other%20programs%20%20into%20the%20output/near/205905027" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Integrating.20other.20programs.20.20into.20the.20output.html#205905027">(Aug 04 2020 at 13:20)</a>:</h4>
<p>The clients, I think, should be able to use several server for a single file</p>



<a name="205905069"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Integrating%20other%20programs%20%20into%20the%20output/near/205905069" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Integrating.20other.20programs.20.20into.20the.20output.html#205905069">(Aug 04 2020 at 13:21)</a>:</h4>
<p>Well, you <em>could</em> plug it into rust-analyzer directly, but then I'll have to maintain it :D</p>



<a name="205906597"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Integrating%20other%20programs%20%20into%20the%20output/near/205906597" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Integrating.20other.20programs.20.20into.20the.20output.html#205906597">(Aug 04 2020 at 13:36)</a>:</h4>
<p>And all the code to implement a LSP server is nicely extracted from r-a and easy to reuse, right?</p>



<a name="205906724"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Integrating%20other%20programs%20%20into%20the%20output/near/205906724" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Integrating.20other.20programs.20.20into.20the.20output.html#205906724">(Aug 04 2020 at 13:36)</a>:</h4>
<blockquote>
<p>And all the code to implement a LSP server is nicely extracted from r-a and easy to reuse, right?</p>
</blockquote>
<p>Somewhat extracted: <a href="https://github.com/rust-analyzer/lsp-server">https://github.com/rust-analyzer/lsp-server</a></p>



<a name="205907983"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Integrating%20other%20programs%20%20into%20the%20output/near/205907983" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Integrating.20other.20programs.20.20into.20the.20output.html#205907983">(Aug 04 2020 at 13:48)</a>:</h4>
<p>Now I just have to do the easy part and write that magical tool.</p>



<a name="205976495"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Integrating%20other%20programs%20%20into%20the%20output/near/205976495" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> David Lattimore <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Integrating.20other.20programs.20.20into.20the.20output.html#205976495">(Aug 05 2020 at 00:19)</a>:</h4>
<p>What kind of search did you have in mind? Just wondering how related it might be to the structural search replace in RA. Or is it something very domain specific?</p>



<a name="206305568"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Integrating%20other%20programs%20%20into%20the%20output/near/206305568" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Integrating.20other.20programs.20.20into.20the.20output.html#206305568">(Aug 07 2020 at 20:29)</a>:</h4>
<p>I’m actually unaware of what RA has so I should look into it. The long answer is <a href="https://github.com/shepmaster/strata-rust">https://github.com/shepmaster/strata-rust</a></p>



<a name="206327090"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Integrating%20other%20programs%20%20into%20the%20output/near/206327090" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> David Lattimore <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Integrating.20other.20programs.20.20into.20the.20output.html#206327090">(Aug 08 2020 at 02:24)</a>:</h4>
<p>Nice! There's probably a small amount of overlap. SSR (<a href="https://rust-analyzer.github.io/manual.html#structural-search-and-replace">https://rust-analyzer.github.io/manual.html#structural-search-and-replace</a>) currently only exposes a search and replace function, not just a straight search. Of the examples you gave, the last one (<code>let Single...</code>) is close to the kind of thing SSR could match (although it doesn't yet support matching statements). The first one (searching for methods that take arguments that implement the trait Foo) is the kind of thing SSR might be able to do in the future (but can't now).</p>
<p>It's not clear if this is something that Strata would support, but something I think would be incredibly useful in an IDE (i.e. in Rust Analyzer) would be a way to say "I need a Foo" and have the IDE provide suggestions for how to get a Foo, possibly taking into account what kinds of things I've already got in the function I'm working on. This might involve a little bit of graph searching, since it might be necessary call more than one function.</p>
<p>This would be great for when you're unfamiliar with a library and don't know that you need to call <code>.into()</code> on a string or something similar in order to get an instance (although obviously documentation helps here too).</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>